package com.scau.action;

import java.util.List;

import net.sf.json.JSONArray;

import com.scau.service.ISaleOrderItemService;
import com.scau.vo.SaleOrderItem;

/**
 * @author Jinglun
 * @create 2017年4月22日
 */
public class SaleOrderItemAction extends SuperAction {
	private String result;// 属性result，用于异步传输数据交互
	
	private SaleOrderItem saleOrderItem;
	private ISaleOrderItemService saleOrderItemService;
	
	public String  saveSerSaleOrderItem(){
		SaleOrderItem saleOI = getSaleOrderItem();
		saleOrderItemService.saveSerSaleOrderItem(saleOI);
		return NONE;
		
		/*if(saleOrderItemService.saveSaleOrderItem(saleOI)){
			List<SaleOrderItem> soiList = saleOrderItemService.listSaleOrderItem();
			JSONArray jsonArray = JSONArray.fromObject(soiList.toString());
			result = jsonArray.toString();
			return "success";
		} else return "error";*/
	}
	public String  saveProSaleOrderItem(){
		SaleOrderItem saleOI = getSaleOrderItem();
		saleOrderItemService.saveProSaleOrderItem(saleOI);
		return NONE;
		
		/*if(saleOrderItemService.saveSaleOrderItem(saleOI)){
			List<SaleOrderItem> soiList = saleOrderItemService.listSaleOrderItem();
			JSONArray jsonArray = JSONArray.fromObject(soiList.toString());
			result = jsonArray.toString();
			return "success";
		} else return "error";*/
	}
	
	// 查出挂账详情
	public String getDebtsItem() {
		SaleOrderItem debts = getSaleOrderItem();
		List<SaleOrderItem> resultItem = saleOrderItemService.getDebtsItem(debts.getSaleOrder().getSaleOrderNo());
		JSONArray jsonArray = JSONArray.fromObject(resultItem.toString());
		result = jsonArray.toString();
		return "success";
	}
	
	// get set methods
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public SaleOrderItem getSaleOrderItem() {
		return saleOrderItem;
	}
	public void setSaleOrderItem(SaleOrderItem saleOrderItem) {
		this.saleOrderItem = saleOrderItem;
	}
	public ISaleOrderItemService getSaleOrderItemService() {
		return saleOrderItemService;
	}
	public void setSaleOrderItemService(ISaleOrderItemService saleOrderItemService) {
		this.saleOrderItemService = saleOrderItemService;
	}
	
	
	
}
